package com.gxa.ssm340.service.impl;

import com.gxa.ssm340.entity.dto.CollectCpnDTO;
import com.gxa.ssm340.entity.pojo.Coupon;
import com.gxa.ssm340.mapper.CouponsMapper;
import com.gxa.ssm340.service.CpnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * @BelongsProject: huanlianchaoshi
 * @Author: Donglu
 * @CreateTime: 2023-10-23  15:19
 */
@Service
@Transactional(rollbackFor = Throwable.class)
public class CpnServiceImpl implements CpnService {

    @Autowired
    private CouponsMapper couponsMapper;

    @Override
    public List<Coupon> selectNotGetCpn(String phone) {
        return couponsMapper.selectNotGetCpn(phone);
    }
    @Override
    public List<Coupon> selectGetCpn(String phone) {
        return couponsMapper.selectGetCpn(phone);
    }
    @Override
    public List<Coupon> selectOverExpire(Date date) {
        return couponsMapper.selectOverExpire(date);
    }




    @Override
    public Integer addGet(CollectCpnDTO collectCpnDTO) {
        Integer integer = couponsMapper.addGet(collectCpnDTO);
        return integer;
    }

    /*我的优惠券*/
    @Override
    public List<Coupon> selectUsedCpn(String phone) {
        return couponsMapper.selectUsedCpn(phone);
    }
    @Override
    public List<Coupon> selectMyOverExpire(String phone) {
        return couponsMapper.selectMyOverExpire(phone);
    }


}
